/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: mirac
 * Date: 2025-07-14
 * Time: 22:36
 */
class Student {
    public String name;
    public int age;

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }
}
//字符串的转换
public class Main_4 {
    public static void main(String[] args) {
        //格式化
        String s1 = String.format("%d/%d/%d",2025,7,14);
        System.out.println(s1);
    }
    public static void main4(String[] args) {
        //字符串转化为数组
        String s1 = "abcdef";
        char[] ch = s1.toCharArray();
        for (int i = 0; i < ch.length; i++) {
            System.out.println(ch[i]);
        }
    }
    public static void main3(String[] args) {
        //大小写转换
        String s1 = "hello";
        String s2 = "HELLO";
        System.out.println(s1.toUpperCase()); //小转大
        System.out.println(s2.toLowerCase()); //大转小
    }
    public static void main2(String[] args) {
        //String 转换为数字
        int data1 = Integer.parseInt("1234");
        double data2 = Double.parseDouble("3.14");
        System.out.println(data1);
        System.out.println(data2);
    }
    public static void main1(String[] args) {
        //数字转换为String
        String s1 = String.valueOf(2025);
        String s2 = String.valueOf(3.14);
        String s3 = String.valueOf(true);
        String s4 = String.valueOf(new Student("小明",12));
        System.out.println(s1);
        System.out.println(s2);
        System.out.println(s3);
        System.out.println(s4);
    }
}
